package com.example.controller;

import com.example.common.result.Result;
import com.example.entity.hz.Printtemplate;
import com.example.service.PrinttemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Api(tags = "打印模版管理前端控制器")
@RestController
@RequestMapping("/api/Printtemplate")
public class PrinttemplateController {

    @Resource
    private PrinttemplateService printtemplateService;

    @ApiOperation("新增打印模版 批量或单独")
    @PostMapping("/savePrintTemplate")
    public Result savePrintTemplate(@RequestBody List<Printtemplate> printtemplateList){
        return this.printtemplateService.savePrintTemplate(printtemplateList);
    }

    @ApiOperation("删除打印模版 批量或单独")
    @PostMapping("/deletePrintTemplate")
    public Result deletePrintTemplate(@RequestBody List<Integer> uidList){
        return this.printtemplateService.deletePrintTemplate(uidList);
    }

    @ApiOperation("通过uid查询打印模版详细信息")
    @GetMapping("queryOne/{uid}")
    public Result<Printtemplate> queryOnePrintTemplate(@PathVariable Integer uid){
        return this.printtemplateService.queryOnePrintTemplate(uid);
    }

    @ApiOperation("修改打印模版信息")
    @PostMapping("updatePrintTemplate")
    public Result updatePrintTemplate(@RequestBody Printtemplate printtemplate){
        return this.printtemplateService.updatePrintTemplate(printtemplate);
    }
}
